/**
 * @summary 生成GUID
 * @name uiCore#guidGenerator
 * @function
 * @returns {string} 唯一标识字符串
 */
function guidGenerator() {
    var s4 = function () {
        return (((1 + Math.random() * 0x10000) | 0).toString(16).substring(1));
    };
    return s4();

}
function GUID() {
    return (guidGenerator() + guidGenerator() + guidGenerator() + guidGenerator() + guidGenerator() + guidGenerator() + guidGenerator() + guidGenerator());
}
/**
 * @summary iframe加载完成事件
 * @name uiCore#iframeLoaded
 * @param iframeID
 * @param loadedEvent
 * @function
 */
function iframeLoaded(iframeID, loadedEvent) {
    var iframe = document.getElementById(iframeID);
    if (_IE) {
        iframe.onload = function () {
            loadedEvent;
        }
    } else {
        iframe.onreadystatechange = function () {
            if (iframe.readyState == 'complete') {
                loadedEvent;
            }
        }
    }
}

/**
 * 日期转换
 * @param format 格式字符串（例如：yyyy-MM-dd）
 * @returns {*}
 */
Date.prototype.format = function (format) {
    var o = {
        "M+": this.getMonth() + 1,
        "d+": this.getDate(),
        "h+": this.getHours(),
        "m+": this.getMinutes(),
        "s+": this.getSeconds(),
        "q+": Math.floor((this.getMonth() + 3) / 3),
        "S": this.getMilliseconds()
    };
    if (/(y+)/.test(format)) {
        format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    }
    for (var k in o) {
        if (new RegExp("(" + k + ")").test(format)) {
            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
        }
    }
    return format;
}
/**
 * 获取链接地址中的参数值
 * @param name 参数名称
 * @returns {*}
 * @constructor
 */
function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return unescape(r[2]);
        return null;
    }
}
